public class GirlFriendTest
{
    public static void main(String[] args) {
        GirlFriend[] arr=new GirlFriend[4];

        GirlFriend g1=new GirlFriend("张三",18,'女',"打数学竞赛");
        GirlFriend g2=new GirlFriend("李四",20,'女',"打英语竞赛");
        GirlFriend g3=new GirlFriend("王五",22,'女',"打计算机竞赛");
        GirlFriend g4=new GirlFriend("赵六",24,'女',"打机器人竞赛");

        arr[0]=g1;
        arr[1]=g2;
        arr[2]=g3;
        arr[3]=g4;

        double sum=0;

        for (int i = 0; i < arr.length; i++) {
            GirlFriend gf=arr[i];
            sum+=gf.getAge();
        }

        double avg=sum/arr.length;
        System.out.println(avg);

        int cnt=0;
        for (int i = 0; i < arr.length; i++) {
            GirlFriend gf=arr[i];
            if(gf.getAge()<avg)
            {
                cnt++;
                System.out.println(gf.getName()+","+gf.getAge()+","+gf.getGender()+","+gf.getHobby());
            }
        }
        System.out.println(cnt);
    }
}
